(0) Obligation:
Clauses:
average(0, 0, 0).
average(0, s(0), 0).
average(0, s(s(0)), s(0)).
average(s(X), Y, Z) :- average(X, s(Y), Z).
average(X, s(s(s(Y))), s(Z)) :- average(s(X), Y, Z).
Query: average(g,a,g)
(1) PrologToDTProblemTransformerProof (SOUND transformation)
Built DT problem from termination graph DT10.
(2) Obligation:
Triples:
averageA(0, s(s(s(X1))), s(0)) :- averageA(0, s(X1), 0).
averageA(s(s(X1)), X2, X3) :- averageA(X1, s(s(X2)), X3).
averageA(s(X1), s(s(X2)), s(X3)) :- averageA(s(X1), X2, X3).
averageA(s(X1), s(s(s(X2))), s(X3)) :- averageA(s(s(X1)), X2, X3).
averageA(X1, s(s(s(X2))), s(X3)) :- averageA(X1, s(X2), X3).
averageA(X1, s(s(s(s(s(s(X2)))))), s(s(X3))) :- averageA(s(s(X1)), X2, X3).
Clauses:
averagecA(0, 0, 0).
averagecA(0, s(0), 0).
averagecA(0, s(0), 0).
averagecA(0, s(s(0)), s(0)).
averagecA(0, s(s(s(X1))), s(0)) :- averagecA(0, s(X1), 0).
averagecA(s(0), 0, 0).
averagecA(s(0), s(0), s(0)).
averagecA(s(s(X1)), X2, X3) :- averagecA(X1, s(s(X2)), X3).
averagecA(s(X1), s(s(X2)), s(X3)) :- averagecA(s(X1), X2, X3).
averagecA(s(X1), s(s(s(X2))), s(X3)) :- averagecA(s(s(X1)), X2, X3).
averagecA(X1, s(s(s(X2))), s(X3)) :- averagecA(X1, s(X2), X3).
averagecA(X1, s(s(s(s(s(s(X2)))))), s(s(X3))) :- averagecA(s(s(X1)), X2, X3).
Afs:
averageA(x1, x2, x3) = averageA(x1, x3)
(3) TriplesToPiDPProof (SOUND transformation)
We use the technique of [DT09]. With regard to the inferred argument filtering the predicates were used in the following modes:
averageA_in: (b,f,b)
Transforming
TRIPLES into the following
Term Rewriting System:
Pi DP problem:
The TRS P consists of the following rules:
AVERAGEA_IN_GAG(0, s(s(s(X1))), s(0)) → U1_GAG(X1, averageA_in_gag(0, s(X1), 0))
AVERAGEA_IN_GAG(0, s(s(s(X1))), s(0)) → AVERAGEA_IN_GAG(0, s(X1), 0)
AVERAGEA_IN_GAG(s(s(X1)), X2, X3) → U2_GAG(X1, X2, X3, averageA_in_gag(X1, s(s(X2)), X3))
AVERAGEA_IN_GAG(s(s(X1)), X2, X3) → AVERAGEA_IN_GAG(X1, s(s(X2)), X3)
AVERAGEA_IN_GAG(s(X1), s(s(X2)), s(X3)) → U3_GAG(X1, X2, X3, averageA_in_gag(s(X1), X2, X3))
AVERAGEA_IN_GAG(s(X1), s(s(X2)), s(X3)) → AVERAGEA_IN_GAG(s(X1), X2, X3)
AVERAGEA_IN_GAG(s(X1), s(s(s(X2))), s(X3)) → U4_GAG(X1, X2, X3, averageA_in_gag(s(s(X1)), X2, X3))
AVERAGEA_IN_GAG(s(X1), s(s(s(X2))), s(X3)) → AVERAGEA_IN_GAG(s(s(X1)), X2, X3)
AVERAGEA_IN_GAG(X1, s(s(s(X2))), s(X3)) → U5_GAG(X1, X2, X3, averageA_in_gag(X1, s(X2), X3))
AVERAGEA_IN_GAG(X1, s(s(s(X2))), s(X3)) → AVERAGEA_IN_GAG(X1, s(X2), X3)
AVERAGEA_IN_GAG(X1, s(s(s(s(s(s(X2)))))), s(s(X3))) → U6_GAG(X1, X2, X3, averageA_in_gag(s(s(X1)), X2, X3))
AVERAGEA_IN_GAG(X1, s(s(s(s(s(s(X2)))))), s(s(X3))) → AVERAGEA_IN_GAG(s(s(X1)), X2, X3)
R is empty.
The argument filtering Pi contains the following mapping:
averageA_in_gag(
x1,
x2,
x3) =
averageA_in_gag(
x1,
x3)
0 =
0
s(
x1) =
s(
x1)
AVERAGEA_IN_GAG(
x1,
x2,
x3) =
AVERAGEA_IN_GAG(
x1,
x3)
U1_GAG(
x1,
x2) =
U1_GAG(
x2)
U2_GAG(
x1,
x2,
x3,
x4) =
U2_GAG(
x1,
x3,
x4)
U3_GAG(
x1,
x2,
x3,
x4) =
U3_GAG(
x1,
x3,
x4)
U4_GAG(
x1,
x2,
x3,
x4) =
U4_GAG(
x1,
x3,
x4)
U5_GAG(
x1,
x2,
x3,
x4) =
U5_GAG(
x1,
x3,
x4)
U6_GAG(
x1,
x2,
x3,
x4) =
U6_GAG(
x1,
x3,
x4)
We have to consider all (P,R,Pi)-chains
Infinitary Constructor Rewriting Termination of PiDP implies Termination of TRIPLES
(4) Obligation:
Pi DP problem:
The TRS P consists of the following rules:
AVERAGEA_IN_GAG(0, s(s(s(X1))), s(0)) → U1_GAG(X1, averageA_in_gag(0, s(X1), 0))
AVERAGEA_IN_GAG(0, s(s(s(X1))), s(0)) → AVERAGEA_IN_GAG(0, s(X1), 0)
AVERAGEA_IN_GAG(s(s(X1)), X2, X3) → U2_GAG(X1, X2, X3, averageA_in_gag(X1, s(s(X2)), X3))
AVERAGEA_IN_GAG(s(s(X1)), X2, X3) → AVERAGEA_IN_GAG(X1, s(s(X2)), X3)
AVERAGEA_IN_GAG(s(X1), s(s(X2)), s(X3)) → U3_GAG(X1, X2, X3, averageA_in_gag(s(X1), X2, X3))
AVERAGEA_IN_GAG(s(X1), s(s(X2)), s(X3)) → AVERAGEA_IN_GAG(s(X1), X2, X3)
AVERAGEA_IN_GAG(s(X1), s(s(s(X2))), s(X3)) → U4_GAG(X1, X2, X3, averageA_in_gag(s(s(X1)), X2, X3))
AVERAGEA_IN_GAG(s(X1), s(s(s(X2))), s(X3)) → AVERAGEA_IN_GAG(s(s(X1)), X2, X3)
AVERAGEA_IN_GAG(X1, s(s(s(X2))), s(X3)) → U5_GAG(X1, X2, X3, averageA_in_gag(X1, s(X2), X3))
AVERAGEA_IN_GAG(X1, s(s(s(X2))), s(X3)) → AVERAGEA_IN_GAG(X1, s(X2), X3)
AVERAGEA_IN_GAG(X1, s(s(s(s(s(s(X2)))))), s(s(X3))) → U6_GAG(X1, X2, X3, averageA_in_gag(s(s(X1)), X2, X3))
AVERAGEA_IN_GAG(X1, s(s(s(s(s(s(X2)))))), s(s(X3))) → AVERAGEA_IN_GAG(s(s(X1)), X2, X3)
R is empty.
The argument filtering Pi contains the following mapping:
averageA_in_gag(
x1,
x2,
x3) =
averageA_in_gag(
x1,
x3)
0 =
0
s(
x1) =
s(
x1)
AVERAGEA_IN_GAG(
x1,
x2,
x3) =
AVERAGEA_IN_GAG(
x1,
x3)
U1_GAG(
x1,
x2) =
U1_GAG(
x2)
U2_GAG(
x1,
x2,
x3,
x4) =
U2_GAG(
x1,
x3,
x4)
U3_GAG(
x1,
x2,
x3,
x4) =
U3_GAG(
x1,
x3,
x4)
U4_GAG(
x1,
x2,
x3,
x4) =
U4_GAG(
x1,
x3,
x4)
U5_GAG(
x1,
x2,
x3,
x4) =
U5_GAG(
x1,
x3,
x4)
U6_GAG(
x1,
x2,
x3,
x4) =
U6_GAG(
x1,
x3,
x4)
We have to consider all (P,R,Pi)-chains
(5) DependencyGraphProof (EQUIVALENT transformation)
The approximation of the Dependency Graph [LOPSTR] contains 1 SCC with 7 less nodes.
(6) Obligation:
Pi DP problem:
The TRS P consists of the following rules:
AVERAGEA_IN_GAG(s(X1), s(s(X2)), s(X3)) → AVERAGEA_IN_GAG(s(X1), X2, X3)
AVERAGEA_IN_GAG(s(s(X1)), X2, X3) → AVERAGEA_IN_GAG(X1, s(s(X2)), X3)
AVERAGEA_IN_GAG(s(X1), s(s(s(X2))), s(X3)) → AVERAGEA_IN_GAG(s(s(X1)), X2, X3)
AVERAGEA_IN_GAG(X1, s(s(s(X2))), s(X3)) → AVERAGEA_IN_GAG(X1, s(X2), X3)
AVERAGEA_IN_GAG(X1, s(s(s(s(s(s(X2)))))), s(s(X3))) → AVERAGEA_IN_GAG(s(s(X1)), X2, X3)
R is empty.
The argument filtering Pi contains the following mapping:
s(
x1) =
s(
x1)
AVERAGEA_IN_GAG(
x1,
x2,
x3) =
AVERAGEA_IN_GAG(
x1,
x3)
We have to consider all (P,R,Pi)-chains
(7) PiDPToQDPProof (SOUND transformation)
Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.
(8) Obligation:
Q DP problem:
The TRS P consists of the following rules:
AVERAGEA_IN_GAG(s(X1), s(X3)) → AVERAGEA_IN_GAG(s(X1), X3)
AVERAGEA_IN_GAG(s(s(X1)), X3) → AVERAGEA_IN_GAG(X1, X3)
AVERAGEA_IN_GAG(s(X1), s(X3)) → AVERAGEA_IN_GAG(s(s(X1)), X3)
AVERAGEA_IN_GAG(X1, s(X3)) → AVERAGEA_IN_GAG(X1, X3)
AVERAGEA_IN_GAG(X1, s(s(X3))) → AVERAGEA_IN_GAG(s(s(X1)), X3)
R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
(9) QDPSizeChangeProof (EQUIVALENT transformation)
By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.
From the DPs we obtained the following set of size-change graphs:
- AVERAGEA_IN_GAG(s(X1), s(X3)) → AVERAGEA_IN_GAG(s(X1), X3)
The graph contains the following edges 1 >= 1, 2 > 2
- AVERAGEA_IN_GAG(s(s(X1)), X3) → AVERAGEA_IN_GAG(X1, X3)
The graph contains the following edges 1 > 1, 2 >= 2
- AVERAGEA_IN_GAG(s(X1), s(X3)) → AVERAGEA_IN_GAG(s(s(X1)), X3)
The graph contains the following edges 2 > 2
- AVERAGEA_IN_GAG(X1, s(X3)) → AVERAGEA_IN_GAG(X1, X3)
The graph contains the following edges 1 >= 1, 2 > 2
- AVERAGEA_IN_GAG(X1, s(s(X3))) → AVERAGEA_IN_GAG(s(s(X1)), X3)
The graph contains the following edges 2 > 2
(10) YES